package sh.ds.el.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import sh.ds.el.dao.UserDao;
import sh.ds.el.entity.UserVO;
import sh.ds.el.exception.ServiceException;
import sh.ds.el.service.UserService;
import sh.ds.el.service.base.impl.ElServiceImpl;

@Service
public class UserServiceImpl extends ElServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;
	
	@Override
	public Boolean isLoginSuccess(String userCode, String password)
			throws ServiceException {
		UserVO queryVo = new UserVO();
		queryVo.setUserCode(userCode);
		queryVo.setPassword(password);
		
		if (userDao.queryUserCount(queryVo) == 1) {
			return true;
		}
		return false;
	}
	
	@Override
	public UserVO queryUniqueUserByUserCode(String userCode)
			throws ServiceException {
		UserVO queryVo = new UserVO();
		queryVo.setUserCode(userCode);
		
		return userDao.queryUniqueUser(queryVo);
	}

}
